{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"getContainer\", \"motion\", \"prefixCls\", \"maxCount\", \"className\", \"style\", \"onAllRemoved\"];\nimport * as React from 'react';\nimport Notifications from './Notifications';\nvar defaultGetContainer = function defaultGetContainer() {\n  return document.body;\n};\nvar uniqueKey = 0;\nfunction mergeConfig() {\n  var clone = {};\n  for (var _len = arguments.length, objList = new Array(_len), _key = 0; _key < _len; _key++) {\n    objList[_key] = arguments[_key];\n  }\n  objList.forEach(function (obj) {\n    if (obj) {\n      Object.keys(obj).forEach(function (key) {\n        var val = obj[key];\n        if (val !== undefined) {\n          clone[key] = val;\n        }\n      });\n    }\n  });\n  return clone;\n}\nexport default function useNotification() {\n  var rootConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  var _rootConfig$getContai = rootConfig.getContainer,\n    getContainer = _rootConfig$getContai === void 0 ? defaultGetContainer : _rootConfig$getContai,\n    motion = rootConfig.motion,\n    prefixCls = rootConfig.prefixCls,\n    maxCount = rootConfig.maxCount,\n    className = rootConfig.className,\n    style = rootConfig.style,\n    onAllRemoved = rootConfig.onAllRemoved,\n    shareConfig = _objectWithoutProperties(rootConfig, _excluded);\n  var _React$useState = React.useState(),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    container = _React$useState2[0],\n    setContainer = _React$useState2[1];\n  var notificationsRef = React.useRef();\n  var contextHolder = /*#__PURE__*/React.createElement(Notifications, {\n    container: container,\n    ref: notificationsRef,\n    prefixCls: prefixCls,\n    motion: motion,\n    maxCount: maxCount,\n    className: className,\n    style: style,\n    onAllRemoved: onAllRemoved\n  });\n  var _React$useState3 = React.useState([]),\n    _React$useState4 = _slicedToArray(_React$useState3, 2),\n    taskQueue = _React$useState4[0],\n    setTaskQueue = _React$useState4[1];\n  // ========================= Refs =========================\n  var api = React.useMemo(function () {\n    return {\n      open: function open(config) {\n        var mergedConfig = mergeConfig(shareConfig, config);\n        if (mergedConfig.key === null || mergedConfig.key === undefined) {\n          mergedConfig.key = \"rc-notification-\".concat(uniqueKey);\n          uniqueKey += 1;\n        }\n        setTaskQueue(function (queue) {\n          return [].concat(_toConsumableArray(queue), [{\n            type: 'open',\n            config: mergedConfig\n          }]);\n        });\n      },\n      close: function close(key) {\n        setTaskQueue(function (queue) {\n          return [].concat(_toConsumableArray(queue), [{\n            type: 'close',\n            key: key\n          }]);\n        });\n      },\n      destroy: function destroy() {\n        setTaskQueue(function (queue) {\n          return [].concat(_toConsumableArray(queue), [{\n            type: 'destroy'\n          }]);\n        });\n      }\n    };\n  }, []);\n  // ======================= Container ======================\n  // React 18 should all in effect that we will check container in each render\n  // Which means getContainer should be stable.\n  React.useEffect(function () {\n    setContainer(getContainer());\n  });\n  // ======================== Effect ========================\n  React.useEffect(function () {\n    // Flush task when node ready\n    if (notificationsRef.current && taskQueue.length) {\n      taskQueue.forEach(function (task) {\n        switch (task.type) {\n          case 'open':\n            notificationsRef.current.open(task.config);\n            break;\n          case 'close':\n            notificationsRef.current.close(task.key);\n            break;\n          case 'destroy':\n            notificationsRef.current.destroy();\n            break;\n        }\n      });\n      setTaskQueue([]);\n    }\n  }, [taskQueue]);\n  // ======================== Return ========================\n  return [api, contextHolder];\n}","map":{"version":3,"names":["_toConsumableArray","_slicedToArray","_objectWithoutProperties","_excluded","React","Notifications","defaultGetContainer","document","body","uniqueKey","mergeConfig","clone","_len","arguments","length","objList","Array","_key","forEach","obj","Object","keys","key","val","undefined","useNotification","rootConfig","_rootConfig$getContai","getContainer","motion","prefixCls","maxCount","className","style","onAllRemoved","shareConfig","_React$useState","useState","_React$useState2","container","setContainer","notificationsRef","useRef","contextHolder","createElement","ref","_React$useState3","_React$useState4","taskQueue","setTaskQueue","api","useMemo","open","config","mergedConfig","concat","queue","type","close","destroy","useEffect","current","task"],"sources":["/data/messenger.client/node_modules/rc-notification/es/useNotification.js"],"sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"getContainer\", \"motion\", \"prefixCls\", \"maxCount\", \"className\", \"style\", \"onAllRemoved\"];\nimport * as React from 'react';\nimport Notifications from './Notifications';\nvar defaultGetContainer = function defaultGetContainer() {\n  return document.body;\n};\nvar uniqueKey = 0;\nfunction mergeConfig() {\n  var clone = {};\n  for (var _len = arguments.length, objList = new Array(_len), _key = 0; _key < _len; _key++) {\n    objList[_key] = arguments[_key];\n  }\n  objList.forEach(function (obj) {\n    if (obj) {\n      Object.keys(obj).forEach(function (key) {\n        var val = obj[key];\n        if (val !== undefined) {\n          clone[key] = val;\n        }\n      });\n    }\n  });\n  return clone;\n}\nexport default function useNotification() {\n  var rootConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  var _rootConfig$getContai = rootConfig.getContainer,\n    getContainer = _rootConfig$getContai === void 0 ? defaultGetContainer : _rootConfig$getContai,\n    motion = rootConfig.motion,\n    prefixCls = rootConfig.prefixCls,\n    maxCount = rootConfig.maxCount,\n    className = rootConfig.className,\n    style = rootConfig.style,\n    onAllRemoved = rootConfig.onAllRemoved,\n    shareConfig = _objectWithoutProperties(rootConfig, _excluded);\n  var _React$useState = React.useState(),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    container = _React$useState2[0],\n    setContainer = _React$useState2[1];\n  var notificationsRef = React.useRef();\n  var contextHolder = /*#__PURE__*/React.createElement(Notifications, {\n    container: container,\n    ref: notificationsRef,\n    prefixCls: prefixCls,\n    motion: motion,\n    maxCount: maxCount,\n    className: className,\n    style: style,\n    onAllRemoved: onAllRemoved\n  });\n  var _React$useState3 = React.useState([]),\n    _React$useState4 = _slicedToArray(_React$useState3, 2),\n    taskQueue = _React$useState4[0],\n    setTaskQueue = _React$useState4[1];\n  // ========================= Refs =========================\n  var api = React.useMemo(function () {\n    return {\n      open: function open(config) {\n        var mergedConfig = mergeConfig(shareConfig, config);\n        if (mergedConfig.key === null || mergedConfig.key === undefined) {\n          mergedConfig.key = \"rc-notification-\".concat(uniqueKey);\n          uniqueKey += 1;\n        }\n        setTaskQueue(function (queue) {\n          return [].concat(_toConsumableArray(queue), [{\n            type: 'open',\n            config: mergedConfig\n          }]);\n        });\n      },\n      close: function close(key) {\n        setTaskQueue(function (queue) {\n          return [].concat(_toConsumableArray(queue), [{\n            type: 'close',\n            key: key\n          }]);\n        });\n      },\n      destroy: function destroy() {\n        setTaskQueue(function (queue) {\n          return [].concat(_toConsumableArray(queue), [{\n            type: 'destroy'\n          }]);\n        });\n      }\n    };\n  }, []);\n  // ======================= Container ======================\n  // React 18 should all in effect that we will check container in each render\n  // Which means getContainer should be stable.\n  React.useEffect(function () {\n    setContainer(getContainer());\n  });\n  // ======================== Effect ========================\n  React.useEffect(function () {\n    // Flush task when node ready\n    if (notificationsRef.current && taskQueue.length) {\n      taskQueue.forEach(function (task) {\n        switch (task.type) {\n          case 'open':\n            notificationsRef.current.open(task.config);\n            break;\n          case 'close':\n            notificationsRef.current.close(task.key);\n            break;\n          case 'destroy':\n            notificationsRef.current.destroy();\n            break;\n        }\n      });\n      setTaskQueue([]);\n    }\n  }, [taskQueue]);\n  // ======================== Return ========================\n  return [api, contextHolder];\n}"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,cAAc,MAAM,0CAA0C;AACrE,OAAOC,wBAAwB,MAAM,oDAAoD;AACzF,IAAIC,SAAS,GAAG,CAAC,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,CAAC;AACzG,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,IAAIC,mBA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